package com.atguigu.guli.service.edu.controller.admin;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.edu.entity.Video;
import com.atguigu.guli.service.edu.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2021-06-24
 */
@RestController
@CrossOrigin
    @RequestMapping("/admin/edu/video")
public class AdminVideoController {
    @Autowired
    private VideoService videoService;

    // 添加课时
    @PostMapping("saveVideo")
    public R saveVideo(@RequestBody Video video) {
        videoService.save(video);
        return R.ok();
    }

    // 删除课时
    @DeleteMapping("delVideo/{videoId}")
    public R delVideo(@PathVariable("videoId") String videoId) {
        videoService.removeById(videoId);
        return R.ok();
    }


}

